﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c="clr-namespace:ChristianMoser.WpfInspector.UserInterface.Controls">

    <Style TargetType="{x:Type c:ColorPicker}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type c:ColorPicker}">
                    <Grid Margin="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="154" />
                            <ColumnDefinition Width="21" />
                            <ColumnDefinition Width="120" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="30" />
                        </Grid.RowDefinitions>
                        <Border BorderThickness="1" BorderBrush="{DynamicResource DefaultBorderBrush}" Margin="4,4,0,0" >
                            <Canvas Width="150" Height="150" x:Name="PART_MixerArea" >
                                <Rectangle Width="150" Height="150">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="1,1" StartPoint="0,1">
                                            <GradientStop Color="#FFFFFFFF" Offset="0" />
                                            <GradientStop Color="{Binding MixerColor, RelativeSource={RelativeSource TemplatedParent}}" Offset="1" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle Width="150" Height="150">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                            <GradientStop Color="#FF000000" Offset="0" />
                                            <GradientStop Color="#00000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Border x:Name="PART_MixerHandle" Canvas.Left="0" Canvas.Top="0" Width="14" Height="14" CornerRadius="7"
                                        BorderThickness="1" Background="Transparent" BorderBrush="Black">
                                    <Border Width="12" Height="12" CornerRadius="6"
                                        BorderThickness="1" Background="Transparent" BorderBrush="White" />
                                </Border>
                            </Canvas>
                        </Border>
                        <Border Grid.Column="1" BorderThickness="0,1,1,1" BorderBrush="{DynamicResource DefaultBorderBrush}" Margin="0,4,4,0" >
                            <Canvas x:Name="PART_ColorBar" Width="20" Height="150">
                                <Rectangle Width="20" Height="150"  >
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                            <GradientStop Color="#FF0000" Offset="0" />
                                            <GradientStop Color="#FFFF00" Offset="0.17" />
                                            <GradientStop Color="#00FF00" Offset="0.33" />
                                            <GradientStop Color="#00FFFF" Offset="0.5" />
                                            <GradientStop Color="#0000FF" Offset="0.66" />
                                            <GradientStop Color="#FF00FF" Offset="0.83" />
                                            <GradientStop Color="#FF0000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Border x:Name="PART_ColorSelector" BorderThickness="1" BorderBrush="Black" Height="8" Background="Transparent" Width="20" >
                                    <Border BorderThickness="1" BorderBrush="White" />
                                </Border>
                            </Canvas>
                        </Border>
                        <Grid Grid.Column="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <TextBlock Text="R" Grid.Row="0" Margin="4" VerticalAlignment="Center" />
                            <TextBlock Text="G" Grid.Row="1" Margin="4" VerticalAlignment="Center" />
                            <TextBlock Text="B" Grid.Row="2" Margin="4" VerticalAlignment="Center" />
                            <TextBlock Text="A" Grid.Row="3" Margin="4" VerticalAlignment="Center" />
                            <TextBlock Text="#" Grid.Row="4" Margin="4" VerticalAlignment="Bottom"/>
                            <TextBox Text="{Binding R, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="1" Grid.Row="0" Margin="4" VerticalAlignment="Center" />
                            <TextBox Text="{Binding G, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="1" Grid.Row="1" Margin="4" VerticalAlignment="Center" />
                            <TextBox Text="{Binding B, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="1" Grid.Row="2" Margin="4" VerticalAlignment="Center" />
                            <TextBox Text="{Binding A, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="1" Grid.Row="3" Margin="4" VerticalAlignment="Center" />
                            <TextBox Text="{Binding Hex, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="1" Grid.Row="4" Margin="4" VerticalAlignment="Bottom" />
                        </Grid>
                        <Border Grid.Row="1" Margin="4,0,0,4" BorderThickness="1,0,1,1" BorderBrush="{DynamicResource DefaultBorderBrush}"
                                Background="{Binding Brush, RelativeSource={RelativeSource TemplatedParent}}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>